package com.mwh.yuantu.dao;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mwh.yuantu.dao.mapper.NavInfoMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mwh.yuantu.entity.NavInfoEntity;

/**
 * (NavInfo)表数据库访问层
 *
 * @author maweihong
 * @since 2023-11-01 09:47:31
 */
@Service
public class NavInfoDao extends ServiceImpl<NavInfoMapper , NavInfoEntity> {

    @Autowired
	private NavInfoMapper navInfoMapper;

    /**
     * 插入新的导航
     * @param navInfo
     * @return
     */
    public int insert(NavInfoEntity navInfo) {
        return navInfoMapper.insert(navInfo);
    }

    /**
     * 更新导航
     * @param navInfo
     * @return
     */
    public int update(NavInfoEntity navInfo) {
        return navInfoMapper.update(navInfo);
    }

    /**
     * 批量删除导航
     * @param idArr 主键数组
     * @return
     */
    public int delete(@Param("idArr") String[] idArr) {
        return navInfoMapper.delete(idArr);
    }

    /**
     * 根据频道主键删除导航
     * @param channelId
     */
    public int deleteByChannelId(String channelId) {
        return navInfoMapper.deleteByChannelId(channelId);
    }

    /**
     * 可用导航列表
     * @return
     */
    public List<NavInfoEntity> listIsUse() {
        return navInfoMapper.listIsUse();
    }

    /**
     * 频道编辑时，同步更新导航
     * @param navInfo
     */
    public int updateByChannel(NavInfoEntity navInfo) {
        return navInfoMapper.updateByChannel(navInfo);
    }


}

